//
//  CGLineView.swift
//  Yolan123
//
//  Created by Fenly on 2018/5/7.
//  Copyright © 2018年 Cotte. All rights reserved.
//

import UIKit

class CGLineView: UIView {

    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.clear
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented");
    }
    
    override func draw(_ rect: CGRect) {
        guard let context = UIGraphicsGetCurrentContext()  else {
            return
        }
        
        let drawingAngleRect = self.bounds.insetBy(dx: 20, dy: 20)
        let drawingLineRect = self.bounds.insetBy(dx: 3, dy: 3)
        
        let path = CGMutablePath()
        path.move(to: CGPoint(x: drawingAngleRect.minX, y: drawingAngleRect.minY))
//        path.addLine(to: CGPoint(x: drawingRect.maxX, y: drawingRect.minY))
//        path.addLine(to: CGPoint(x: drawingRect.maxX, y: drawingRect.maxY))
        context.addPath(path)
        context.setStrokeColor(UIColor.black.cgColor)
        context.setLineWidth(1)
        context.strokePath()
    }
}
